<?php 
include("includes/code_admin.php");
if (isset($_GET['id'])) {$id = $_GET['id'];}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title><?php echo SITEURL; ?> Administrator</title>
<link href="style_admin.css" rel="stylesheet" type="text/css" />
<!-- TinyMCE -->
<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "jbimages,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,|,jbimages",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Bu kod rasm yuklash plugini uchun (jbimages plugini)
        relative_urls : false,
		
		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "tinymce/examples/lists/template_list.js",
		external_link_list_url : "tinymce/examples/lists/link_list.js",
		external_image_list_url : "tinymce/examples/lists/image_list.js",
		media_external_list_url : "tinymce/examples/lists/media_list.js",

		// Style formats
		style_formats : [
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Example 1', inline : 'span', classes : 'example1'},
			{title : 'Example 2', inline : 'span', classes : 'example2'},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		],

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
<!-- /TinyMCE -->
</head>

<body>
<div id="container">
<table class="main" cellspacing="0" cellpadding="0">
  <tr>
    <td class="header">
    <!-- header start -->
    <?php include("includes/header.php");?>
    <!-- header finish -->
    </td>
  </tr>
  <tr>
    <td class="middle">&nbsp;</td>
  </tr>
  <tr>
    <td>
    <!-- tepa start -->
<?php include("includes/tepa.php"); ?>
    <!-- tepa finish -->
    </td>
  </tr>
  <tr>
    <td>
    <!-- contant start -->
<table class="content" cellspacing="0" cellpadding="0">
  <tr valign="top">
    <td>
    <!-- right col -->
<div class="right_col">
<h3 class="title">Sahifani o'zgartirish</h3>

<?php 
if(!isset($id))
{
$result = mysql_query("SELECT id,topmenu FROM pages");
$myrow = mysql_fetch_array($result);

echo "<table class='jadval'>";

	do {
	printf("<tr> <td>
        <span class='tovar'>%s)  %s </span> 
        <span class='view'><a href='page.php?id=%s'> 
		<img src='img/edit.png' width='16' height='16' align='absmiddle' /> O'zgartirish </a></span>
    	</td>
   	 	</tr>", $myrow["id"], $myrow["topmenu"], $myrow["id"]);
	}
	while($myrow = mysql_fetch_array($result));

echo "</table>";
}
else
{
$result = mysql_query("SELECT id,topmenu,title,text FROM pages WHERE id='$id' ");
$myrow = mysql_fetch_array($result);

$id = $myrow["id"];
$topmenu = stripslashes($myrow["topmenu"]);
$title = stripslashes($myrow["title"]);
$text = stripslashes($myrow["text"]);
?>

<fieldset>
<legend style="color:#728D9E">Sahifaga yangi matnlar kiritish</legend>

<form name="myform" action="page_update.php" method="post">
<table width="90%" border="0" cellspacing="7" cellpadding="3">
  <tr>
    <td>Menu nomi:<br />
      <input name="topmenu" type="text" size="40" value="<? echo $topmenu; ?>"/></td>
  </tr>
  <tr>
    <td>Sahifa Sarlavhasi: <br />
    <input name="title" type="text" size="40" value="<? echo $title; ?>"/></td>
  </tr>
  <tr>
    <td>Text: &nbsp; 
    <span style="font:12px; color:#666666">(Fayl yoki rasm yuklash uchun hosting: <a href="http://file.uznet.net">file.uznet.net</a>
    yoki <a href="http://img.uz">img.uz</a></span> <br /> 

	<textarea cols="100" rows="25" name="text"><? echo $text; ?></textarea>
    <input name="id" type="hidden" value="<? echo $id; ?>" />    
    </td>
  </tr>
  <tr>
    <td>
    <input type="submit" name="send" value=" Saqlash " /> 
	</td>
  </tr>
</table>
</form>

<br /><a href="javascript: history.back()">Orqaga qaytish</a>
</fieldset>
<?php 
}
?>
</div>
	<!-- right col finish -->
    </td>
  </tr>
</table>


    <!-- contant finish -->
    </td>
  </tr>
</table>
<!-- futer start -->
<?php include("includes/futer.php"); ?>
<!-- futer finish -->
</div>
</body>
</html>
